package org.cjstudio.holypoopsgrs.test.util;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.cjstudio.holypoopsgrs.model.UserProfile;
import org.cjstudio.holypoopsgrs.model.UserRecord;

public class SampleData {

	public static UserProfile getSampleProfile(int i) {		
		UserProfile profile = new UserProfile();
		profile.udid = "SAMPLE UDID " + i;
		profile.name = "SAMPLE NAME " + i;
		profile.highest = 10000 - i;
		profile.rank = 1 + i;
		profile.highestDate = new Date();
		profile.message = "SAMPLE MESSAGE " + i;
		profile.updateDate = new Date();
		profile.numOfRecords = 1;
		profile.averageScore = 100;

		List<UserRecord> records = new ArrayList<UserRecord>();
		for(int j=0; j<10; j++) {
			records.add(getSampleRecord(j));
		}
		profile.topTenRecords = records;

		return profile;
	}

	public static UserRecord getSampleRecord(int i) {
		UserRecord record = new UserRecord();
		record.score = 10 * (10 - (i + 1));
		record.scoreDate = new Date();

		return record;
	}

	public static UserProfile getRevisedProfile(UserProfile profile) {
		profile.setName(profile.name + " updated!");
		profile.setHighest(profile.highest + 100);
		profile.setRank(profile.rank + 4);
		profile.setHighestDate(new Date());
		profile.setMessage(profile.message + " updated!");
		profile.setUpdateDate(new Date());
		profile.setNumOfRecords(profile.numOfRecords * 2);
		profile.setAverageScore(profile.averageScore + 10);

		profile.topTenRecords.get(0).score += 3;
		profile.topTenRecords.get(0).scoreDate = new Date();
		profile.topTenRecords.remove(2);
		profile.topTenRecords.add(getSampleRecord(11));
		profile.setTopTenRecords(profile.topTenRecords);
		return profile;
	}
}
